﻿public class Student {
    public int Id { get; set; }
}

public class Program {
    public static void Main(string[] args) {
        var student = new Student { Id = 1 };
        Foo(student);
        Console.WriteLine($"Student #{student.Id}");
    }

    public static void Foo(Student s) {
        s = new Student { Id = 2 };
    }
}